<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>xilpuf: xilpuf_enc_dec_data_client_example.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">xilpuf
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;"
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xilpuf__enc__dec__data__client__example_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">xilpuf_enc_dec_data_client_example.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This file illustrates encryption and decryption of user data using PUF KEY. </p>
<p>The key can be generated using either PUF registration or PUF on demand regeneration. To build this application, xilmailbox library must be included in BSP and xilsecure and xilpuf must be in client mode.</p>
<p>This example is supported for Versal and Versal Net devices.</p>
<pre>
 MODIFICATION HISTORY:</pre><pre> Ver   Who   Date     Changes
</p>
<hr/>
<p>
 1.0   kpt  01/04/22 Initial release
       kpt  01/13/22 Added support to run example on PL microblaze
       har  01/20/22 Removed inclusion of xil_mem.h
       har  03/04/22 Added comment to specify mode of libraries
       kpt  03/16/22 Removed IPI related code and added mailbox support
       har  03/31/22 Updated default data and data length
       kpt  04/08/22 Added comment on usage of shared memory
 2.1   am   04/13/23 Fix PUF auxiliary convergence error
 2.2   am   05/03/23 Added KAT before crypto usage
         vss  11/22/23 Added header file required for SDT flow</pre><pre> <dl class="section note"><dt>Note</dt><dd></dd></dl>
<h2>User configurable parameters for PUF
</h2>
</pre><pre>
 #define XPUF_DATA                              "000000000000000000000000"
 Data to be encrypted by PUF KEY should be provided in string format.</pre><pre> #define XPUF_DATA_LEN_IN_BYTES         (0U)
 Length of data to be encrypted should be provided in bytes, where number of
 bytes must be a multiple of 4.</pre><pre> #define XPUF_IV                                "000000000000000000000000"
 IV should be provided in string format. It should be 24 characters long, valid
 characters are 0-9, a-f, A-F. Any other character is considered as invalid
 string. The value mentioned here will be converted to hex buffer. It is used
 with the AES-GCM cryptographic hardware in order to encrypt user data.</pre><pre> #define XPUF_KEY_GENERATE_OPTION               (XPUF_REGISTRATION)
                                                        (or)
                                                (XPUF_REGEN_ON_DEMAND)
 PUF helper data can be generated by PUF registration or PUF on-demand
 regeneration. The user can configure XPUF_KEY_GENERATE_OPTION as either
 XPUF_REGISTRATION or XPUF_REGEN_ON_DEMAND to select the mode of PUF operation
 to generate helper data</pre><pre> #define XPUF_READ_HD_OPTION                    (XPUF_READ_FROM_RAM)
                                                        (or)
                                                (XPUF_READ_FROM_EFUSE_CACHE)
 This selects the location from where the helper data must be read by the
 application. This option must be configured if XPUF_KEY_GENERATE_OPTION
 is configured as XPUF_REGEN_ON_DEMAND.</pre><pre> #define XPUF_CHASH                             (0x00000000)
 The length of CHASH should be 24 bits. It is valid only for PUF regeneration
 and invalid for PUF registration. CHASH value should be supplied if
 XPUF_READ_HD_OPTION is configured as XPUF_READ_FROM_RAM.</pre><pre> #define XPUF_AUX                               (0x00000000)
 The length of AUX should be 32 bits. It is valid only for PUF regeneration
 and invalid for PUF registration. AUX value should be supplied if
 XPUF_READ_HD_OPTION is configured as XPUF_READ_FROM_RAM.</pre><pre> #define XPUF_SYN_DATA_ADDRESS          (0x00000000)
 Address of syndrome data should be supplied if XPUF_READ_HD_OPTION is
 configured as XPUF_READ_FROM_RAM.</pre><pre> #define XPUF_GLBL_VAR_FLTR_OPTION      (TRUE)
 It is recommended to always enable this option to ensure entropy. It can
 be configured as FALSE to disable Global Variation Filter.</pre><pre> This file illustrates encryption of red key using PUF KEY and
 programming the black key and helper data in a user specified location
 To build the application, xilsecure, xilnvm and xilpuf must be in client mode.</pre><pre><h2>Procedure to link and compile the example for the default ddr less designs
</h2>
</pre><pre>
 The default linker settings places a software stack, heap and data in DDR memory. For this example to work,
 any data shared between client running on A72/R5/PL and server running on PMC, should be placed in area
 which is acccessible to both client and server.</pre><pre> Following is the procedure to compile the example on OCM or any memory region which can be accessed by server
</p>
<pre class="fragment">           1. Open example linker script(lscript.ld) in Vitis project and section to memory mapping should
                   be updated to point all the required sections to shared memory(OCM or TCM)
                   using a memory region drop down selection

                                           OR

           1. In linker script(lscript.ld) user can add new memory section in source tab as shown below
                   .sharedmemory : {
                   . = ALIGN(4);
                   __sharedmemory_start = .;
                   *(.sharedmemory)
                   *(.sharedmemory.*)
                   *(.gnu.linkonce.d.*)
                   __sharedmemory_end = .;
                   } &gt; versal_cips_0_pspmc_0_psv_ocm_ram_0_psv_ocm_ram_0

           2. In this example ".data" section elements that are passed by reference to the server-side should
              be stored in the above shared memory section. To make it happen in below example,
              replace ".data" in attribute section with ".sharedmemory". For example,
   static XPuf_DataAddr PufData __attribute__ ((aligned (64U)) __attribute__ ((section (".data.PufData")));
                                   should be changed to
   static XPuf_DataAddr PufData __attribute__ ((aligned (64U)) __attribute__ ((section (".sharedmemory.PufData")));
</pre></pre><pre> To keep things simple, by default the cache is disabled for this example
</pre></div></div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
